﻿using UnityEngine;

/// <summary>
/// Provides extension suport for <see cref="Vector2"/>.
/// </summary>
public static class Vector2Extension
{
    public static Vector2 SetX(this Vector2 self, float x)
    {
        self.x = x;
        return self;
    }
    public static Vector2 SetY(this Vector2 self, float y)
    {
        self.y = y;
        return self;
    }
    /// <summary>
    /// Negates the X coordinate of <see cref="Vector2"/>.
    /// </summary>
    public static Vector2 NegateX(this Vector2 self)
    {
        self.x = -self.x;
        return self;
    }
    /// <summary>
    /// Negates the Y coordinate of <see cref="Vector2"/>.
    /// </summary>
    public static Vector2 NegateY(this Vector2 self)
    {
        self.y = -self.y;
        return self;
    }

    public static float XDividedByY(this Vector2 self)
    {
        return self.x / self.y;
    }
    public static float YDividedByX(this Vector2 self)
    {
        return self.y / self.x;
    }
}